package GreedyAlgorithm;

import java.util.Arrays;

/**
 * @ClassName LC455
 * @Description 分发饼干
 * @Author ZJX
 * @Date 2024/9/16 19:04
 * @Version 1.0
 */

//     https://leetcode.cn/problems/assign-cookies/description/
public class LC455 {
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int count = 0;
        for (int i = 0; i < s.length && count <= g.length; i++) {
            if (s[i] >= g[count]){
                count++;
            }
        }
        return count;
    }
}
